<script lang="ts" setup>
  import { User } from '@/types/user';

  defineProps<{
    userInfo: User;
  }>();
</script>

<template>
  <div class="user-card">
    <div class="user-card-icon">
      <img v-if="userInfo.profile" :src="userInfo.profile" />
    </div>
    <div class="user-card-info">
      <div class="user-card-name">
        <a-space>
          {{ userInfo.nickname }}
          <a-tag :color="userInfo.sex ? 'blue' : 'red'">
            {{ ['女', '男'][userInfo.sex] }}
          </a-tag>
        </a-space>
      </div>
      <div class="user-card-desc">ID: {{ userInfo.id }}</div>
    </div>
  </div>
</template>

<style lang="less" scoped>
  .user-card {
    display: flex;
    align-items: center;
    &-icon {
      width: 60px;
      height: 60px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgb(var(--gray-1));
      img {
        max-width: 100%;
        max-height: 100%;
      }
    }

    &-info {
      flex: 1;
      min-width: 0;
      margin-left: 10px;
    }

    &-name {
      font-size: 15px;
      font-weight: 500;
    }

    &-desc {
      color: var(--color-text-2);
    }
  }
</style>
